import request from '@/utils/request'

export default {
    selectOrder(id){
        return request({
            url: `/activityOrder/selectOneByActivityId/${id}`,
            method: 'get',
            
        })
    },

    //显示所有订单
    selectAll(page,limit,headlineShowQuery,id) {
        return request({
            url: `/activityOrder/selectByActivityId`,
            method: 'post',
            data: {
                
                id:id,
                page:page,
                limit:limit,
                userNameOrTelphone:headlineShowQuery.name,
                upTime:headlineShowQuery.endTime,
                timeLimit:headlineShowQuery.startTime,
                stateOfCourse:headlineShowQuery.stateOfCourse

            }
        })
    },
     //根据状态分类订单
     selectByState(page, limit,state) {
        return request({
            url: `/CourseOrder/selectByState?state=${state}&page=${page}&limit=${limit}`,
            method: 'get'
        })
    },
    //根据条件搜索订单
    selectBykeyWord(page, limit,selectByAny) {
        return request({
            url: `/CourseOrder/selectBykeyWord?page=${page}&limit=${limit}`,
            method: 'post',
            data: selectByAny
        })
    },
    //查看订单
    selectByID(id) {
        return request({
            url: `/CourseOrder/selectByID?id=${id}`,
            method: 'get'
        })
    },
    //删除订单，已关闭才能删除，根本不可见
    deleteOne(id) {
        return request({
            url: `/CourseOrder/deleteOne?id=${id}`,
            method: 'get'
        })
    },
    //结束课程，学习中才能结束，状态为已完成
    endCourse(id) {
        return request({
            url: `/CourseOrder/endCourse?id=${id}`,
            method: 'get'
        })
    },
    //取消订单，待付款、学习中才能取消，状态为已关闭
    cancelOrder(id) {
        return request({
            url: `/CourseOrder/cancelOrder?id=${id}`,
            method: 'get'
        })
    },
    //购买课程生成订单
    addOrder(courseOrder) {
        return request({
            url: `/CourseOrder/addOrder`,
            method: 'post',
            data: courseOrder
        })
    }
}